<template>
	<view class="page">
		<view class="bg2 u-flex" :style="{backgroundImage:'url('+imagesurl+'app/images/coupon.png)'   }"
			v-for="(item,index) in list" :key="index">
			<view class="" style="width: 210rpx;text-align: center;">
				<view class="" style="color: #fff;font-size: 50rpx;">
					<text style="font-size: 30rpx;">￥</text> {{item.saleMoney}}
				</view>
			</view>
			<view class="" style="width: 400rpx;padding:0 40rpx ;">
				<view style="font-weight: bold;font-size: 30rpx;" v-if="item.needMoney!=='0.00'">
					满{{item.needMoney}}减{{item.saleMoney}}优惠券</view>
				<view style="font-weight: bold;font-size: 30rpx;" v-else>{{item.needMoney=='0.00'?'通用券':'满减券'}}</view>
				<view style="margin: 20rpx 0;font-size: 24rpx;color: #999999;">{{item.endStr}}</view>
				<view style="font-size: 24rpx;color: #999999;padding-top: 20rpx;" class="u-border-top">不可叠加使用</view>
			</view>
			<view class="" style="width: 80rpx;;text-align: center;">
				<view style="color: #5596FF" @click="agreeCoupond(item)">
					立</br>即</br>领</br>取
				</view>
			</view>
		</view>
		<u-loadmore :status="initial.status" v-if="list.length" />
	</view>
</template>

<script>
	import loader from '@/common/loadPage.js';
	import url from '@/common/baseUrl.js';
	
	export default {
		mixins: [loader],
		data() {
			return {
				list: [],
				initial: {
					geturl: "/api/index/coupon",
					parm: {
						store_id: ''
					},
					isPage: true
				},
				imagesurl: url.imageUrl,
			}
		},
		onLoad(option) {
			if (option.id) {
				this.initial.parm.store_id = option.id
			}
		},
		onShow() {
			this.getGoods()
		},
		methods: {
agreeCoupond(item) {
				this.$u.post('/api/user/getCoupon', {
					coupon_id: item.id,

				}).then(res => {
					this.$u.toast("领取成功")

				}).catch(err => {

				})
			},
		}
	}
</script>

<style>
	.page{
		background: #F1F1F1;
		min-height: 100vh;
		display: inline-block;
		width: 100%;
	}
	.bg2 {
		background-size: cover;
		width: 690rpx;
		height: 200rpx;


		margin: 30rpx auto;
	}
</style>
